from qiniu import Auth, put_file, etag
import qiniu.config
from .settings import ACCESS_KEY,SECRET_KEY,BUCKET_NAME

q = Auth(ACCESS_KEY,SECRET_KEY)

def getimg(key):
    token = q.upload_token(BUCKET_NAME, key, 3600)
    localfile = './致命诱惑.mp4'
    ret, info = put_file(token, key, localfile, version='v2')
    print(info)
    assert ret['key'] == key
    assert ret['hash'] == etag(localfile)